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