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