UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9tfzgwd/t7Rehv8FDHQjiggVzigBSluKg5iPLPazfCY=' 
WHERE 
  key_id = '40414d25edffc1d0bd9c83e51fe60c36dd0675b5baacbe7931179317b99b1fe1' 
  AND (
    token = '9tfzgwd/t7Rehv8FDHQjiggVzigBSluKg5iPLPazfCY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048