UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kl/Z1BnvvhiRaqk54Sslw+68isOoSoL3/y1tSLkytBY=' 
WHERE 
  key_id = 'b304ce6e1b822f92871a4a53653841a0343ea4aa97dc6edb6691e26163603c28' 
  AND (
    token = 'kl/Z1BnvvhiRaqk54Sslw+68isOoSoL3/y1tSLkytBY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032