UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cs3pDT5nEbvEYiyozR7GaFPzXVTEJ1Zrr66rGci6XmM=' 
WHERE 
  key_id = 'c9fc4f6ae8cd7ed4574935a546ec849e65713e989326924212f5b1b602e4885d' 
  AND (
    token = 'cs3pDT5nEbvEYiyozR7GaFPzXVTEJ1Zrr66rGci6XmM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036