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