UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QhIeKbISJ437qJOtAYL5gGEgT0JLspX5r2i20AwOSQ4='
WHERE
key_id = 'c6e6e57760ab669f81d0a19145876801d6905d251ed6000a3df38b36b9cd69a4'
AND (
token = 'QhIeKbISJ437qJOtAYL5gGEgT0JLspX5r2i20AwOSQ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)