UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A7+zQsQ5KnzWN9jS4dRuiVzy0EmT2aRRWxAkwga/LJg=' 
WHERE 
  key_id = '2ceedec6fe6f66b56c183e0c85c36571ac3a9558aa315309fcb8b5788a454ed6' 
  AND (
    token = 'A7+zQsQ5KnzWN9jS4dRuiVzy0EmT2aRRWxAkwga/LJg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023