UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KixTfdn5trWesqurEG16zS1muKzehxOEu3mvKlHhAl8=' 
WHERE 
  key_id = '5b67532c4021f4b94dc53bb872b932c100b0d4ea6cc29645db847b431d19e937' 
  AND (
    token = 'KixTfdn5trWesqurEG16zS1muKzehxOEu3mvKlHhAl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033