UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tPmuxdsEZuC/WC6JfZes3IF+KMIpNsly4Qe/VdAFWl4=' 
WHERE 
  key_id = '393b26a0470bc134315dae7627c1b8bf2f424609832006f3c9cf163c013d10a7' 
  AND (
    token = 'tPmuxdsEZuC/WC6JfZes3IF+KMIpNsly4Qe/VdAFWl4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031