UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '240ihUPxT/NTMQzM6p5b2qaRQL58Jbu5jtGk5U6ZXlU='
WHERE
key_id = '5b7f0342f08c82813b13c67fa948fd1e6db273dd1989f743a240b9256e3a8822'
AND (
token = '240ihUPxT/NTMQzM6p5b2qaRQL58Jbu5jtGk5U6ZXlU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)