UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TvvXC2rj7s0qM9r1Ht+E9C0lyRmZ4xI3vMF0SOAQ3Ys='
WHERE
key_id = '82970580ee7849c8cc69598db24c124aefae202643b8b9fd9f21a2bacf766d41'
AND (
token = 'TvvXC2rj7s0qM9r1Ht+E9C0lyRmZ4xI3vMF0SOAQ3Ys='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)