UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ghid6aidixaQZQizUbXEWOu0vvSyQD3E+BEOuJtOY64='
WHERE
key_id = 'c1477b35f03774e5148f44cecc89ebdf214270cdd132f1a9cead03d4a1ec59db'
AND (
token = 'Ghid6aidixaQZQizUbXEWOu0vvSyQD3E+BEOuJtOY64='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)