UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3jLCEauzAXlNS5gnhTAOPFZ9qafmfdLGPf4WRj1gzAY='
WHERE
key_id = 'f093c8df11049e56b50c76827cee963dddcece1bb25fa8bdf8cace33ca0d80d3'
AND (
token = '3jLCEauzAXlNS5gnhTAOPFZ9qafmfdLGPf4WRj1gzAY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)