UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Uq9VpJNThtBeqx1lIwGl596V/uUW/e7GAELAM/C1fIY='
WHERE
key_id = '9c1692ded9b5b61acd6d553d0220a55259e3545859427357fb7710a93632140a'
AND (
token = 'Uq9VpJNThtBeqx1lIwGl596V/uUW/e7GAELAM/C1fIY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)