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