UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DUC+BCNFpJh7hbrKFQImMawPHXDFYISvnx0T7pdi/fs=' 
WHERE 
  key_id = '8c61bb15478b7a337dd9b00c5ea64e1f59042a1e83de266e8ae4dac61eb041ff' 
  AND (
    token = 'DUC+BCNFpJh7hbrKFQImMawPHXDFYISvnx0T7pdi/fs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032