UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C2k5rh+wsRIjBUKoGkj30j02AanKRupv82+U5EFVIWE=' 
WHERE 
  key_id = '2d1e0641fb058444062cc0f6481c0afd500fd3df83ccaddf3727ae8af1251fdf' 
  AND (
    token = 'C2k5rh+wsRIjBUKoGkj30j02AanKRupv82+U5EFVIWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021