UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'we8kxnm3bHkFZO387FIm/i0AjDxW7StoZ0Tw8gP533A=' 
WHERE 
  key_id = '3d3309482aa865bf057fb9e9a8586b532dcc231916b8bd839880c6cd4a2b5745' 
  AND (
    token = 'we8kxnm3bHkFZO387FIm/i0AjDxW7StoZ0Tw8gP533A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047