UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NPW3IRkc3UksbKa+H0cMty5WzmjifdZAqj3p5EYbGaE=' 
WHERE 
  key_id = '9660cda504c7b8b0203195dd432463013b378cf071b2325fc6c91b05c419dc7f' 
  AND (
    token = 'NPW3IRkc3UksbKa+H0cMty5WzmjifdZAqj3p5EYbGaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028