UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NqD2/oAmYFBds0cufPzs4wihmiqwEMpvn6xSkQIsnME='
WHERE
key_id = 'e93c4ffc751543e250f658020e57cf09ec02f39fe1af1487e565b0330f1e2eee'
AND (
token = 'NqD2/oAmYFBds0cufPzs4wihmiqwEMpvn6xSkQIsnME='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)