UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vV6axZUJCvlOgWmdwBXNc9Mvs8sVg/EBj3QgRkMhSOE=' 
WHERE 
  key_id = '18b08bbceee213840d9558b388480c3e3a292fa7cc763b505d845f71a0be0545' 
  AND (
    token = 'vV6axZUJCvlOgWmdwBXNc9Mvs8sVg/EBj3QgRkMhSOE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032