UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oRB45AyafjKdW/F2Yz6JWuF1qrEisWwwwGLlV7xolYg='
WHERE
key_id = '2dba4573fc902fd59e8057d93f4b8bcf7049d79c9dfe41f8a57fa0b49149853b'
AND (
token = 'oRB45AyafjKdW/F2Yz6JWuF1qrEisWwwwGLlV7xolYg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)