UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e3htwlW5Oa2Yy9qcavGGwriGEMZ/SkaXVcZYwNl83AU='
WHERE
key_id = 'e5e2ceb05f46fe9eb4534e978d7686754bba3312a78c1849c6069113b67b782a'
AND (
token = 'e3htwlW5Oa2Yy9qcavGGwriGEMZ/SkaXVcZYwNl83AU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)