UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XPNYERq3r4JqN99NdJ9xK6euq1pf7WGhIjpjd1w8xa4='
WHERE
key_id = '4afa83432a72e9a59b0b891ae3f5fa7a813c9f1d1b8f99a1af831a4026a06b09'
AND (
token = 'XPNYERq3r4JqN99NdJ9xK6euq1pf7WGhIjpjd1w8xa4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)