UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qh4AgFXImhE+TH0X23Y6qrgltceJ4vPCboOz1txpsWs=' 
WHERE 
  key_id = '9dca6d9ea6f6ce2e9aaf96fe2fc3d68173dcdaf8b21238692278fc8270c2c7e7' 
  AND (
    token = 'qh4AgFXImhE+TH0X23Y6qrgltceJ4vPCboOz1txpsWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027