UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ns2PSTOJVsxWm4iX5Lh+pgw0ext0lddU2I8fx1bjw/8='
WHERE
key_id = 'b1d9b640ae67d60b42c2fc3cc1d81b1b3b4e8bfdda3d48e06f5b60b26d8e9157'
AND (
token = 'ns2PSTOJVsxWm4iX5Lh+pgw0ext0lddU2I8fx1bjw/8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)