UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rT240yI37kbOoc0U3BS58TwU5kUWPxpkWV+lj+8oRcY='
WHERE
key_id = 'd5d5021ab9df98d57e101fb74629d8ec9583f1f46c46c483b09d36fb3e2d5106'
AND (
token = 'rT240yI37kbOoc0U3BS58TwU5kUWPxpkWV+lj+8oRcY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)