UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sJSIZDm8jTtDKWY4SbCyPvW8wjTz3231kJL+s7kOj9U='
WHERE
key_id = 'd88f91428dcf109741e5a44a1c95c458617ce6dc3e2a1ccbc9fd3c8c8613db91'
AND (
token = 'sJSIZDm8jTtDKWY4SbCyPvW8wjTz3231kJL+s7kOj9U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)