UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4QcBLo0ycJaMZUoxxjJtNNave+1TUt8FgBBn8fNoO4U='
WHERE
key_id = 'fa7b460c07924e4c690d3d541db9efffe9ae544c2ca801b39cbe68947abf6c43'
AND (
token = '4QcBLo0ycJaMZUoxxjJtNNave+1TUt8FgBBn8fNoO4U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)