UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hDNpEKh9KX/xp9+dJuR+myDeMVujJ1r5nl8XBIGRHIo='
WHERE
key_id = 'e89e816c79ce136d2814d090ece9fdddd400f4e0f2b78a70cfd5913891abb45f'
AND (
token = 'hDNpEKh9KX/xp9+dJuR+myDeMVujJ1r5nl8XBIGRHIo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)