UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o+MF4Z6xkKr1v0lXKYhu7SZb4M8I5raiOTP4mehI0dk='
WHERE
key_id = 'a7cd39290e17b9a846106270756d4075e86e2fd23737ee950194d426737dd1b3'
AND (
token = 'o+MF4Z6xkKr1v0lXKYhu7SZb4M8I5raiOTP4mehI0dk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)