UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AyIhFFvbgmG1oyXvs++5lfaNC7hN/ySx6JSL9Fq1HjA='
WHERE
key_id = 'f9bdeaceb0fdcc4036dcda500e800ab043fbe0eee8eca6f798ba263dcc66b305'
AND (
token = 'AyIhFFvbgmG1oyXvs++5lfaNC7hN/ySx6JSL9Fq1HjA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)