UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8I6fTYiMeRxnUEEdU4vhUlTknXDJjzEf7vMkFvU1X3A='
WHERE
key_id = 'b8d87d7d6664173e4ee05f1a8fba24eb44d102c8aeb52bde4df792880b230707'
AND (
token = '8I6fTYiMeRxnUEEdU4vhUlTknXDJjzEf7vMkFvU1X3A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)