UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sSUnUBkpraNiYp2aaPJQYCK5kKp+VqEChpurf+p1yZI=' 
WHERE 
  key_id = '310ae6f8f5db2e569c46d7f56354ac2cc164f5b580b46f1744644dd3471f9774' 
  AND (
    token = 'sSUnUBkpraNiYp2aaPJQYCK5kKp+VqEChpurf+p1yZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028