UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mGQPBZJUN09grIm834AGZNvGtj9bsazauPQ+RTq6ZIk='
WHERE
key_id = 'd3f3afa001e8ec28f9ca05cc52da877ec28e35734d5d263661486141d6533d6f'
AND (
token = 'mGQPBZJUN09grIm834AGZNvGtj9bsazauPQ+RTq6ZIk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)