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